import Vue from 'vue'
import App from './App.vue'
import Vuex from 'vuex'
import router from './router'

Vue.use(Vuex)

Vue.config.productionTip = false

// 实例化 vuex
let store = new Vuex.Store({
  state: {
    n: 100
  },
  mutations: {
    changeN (state) {
      let m = state.n
      state.n = ++m
    } 
  }
})

new Vue({
  router,
  store, // 注入到根实例中，每个组件都可以使用这个 store
  render: h => h(App),
}).$mount('#app')
